home *** CD-ROM | disk | FTP | other *** search
/ The Games Machine 165 / XENIATGM165.ISO / Goodies / Toca Race Driver Etoy / racedriver-etoy.exe / race_downloadable.dcr / Internal_91_Point vector code.ls < prev    next >
Encoding:
Text File  |  2002-08-16  |  434 b   |  17 lines

  1. on pointLength iPoint
  2.   return sqrt((iPoint.locH * iPoint.locH) + (iPoint.locV * iPoint.locV))
  3. end
  4.  
  5. on rotateVector iPoint, iAngle
  6.   iAngleRads = iAngle * PI / 180.0
  7.   ix = iPoint.locH
  8.   iy = iPoint.locV
  9.   cAng = cos(iAngleRads)
  10.   sAng = sin(iAngleRads)
  11.   return point((ix * cAng) + (iy * sAng), (ix * sAng) - (iy * cAng))
  12. end
  13.  
  14. on dotProduct vector1, vector2
  15.   return (vector1.locH * vector2.locH) + (vector1.locV * vector2.locV)
  16. end
  17.